home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / share / 17 / dings_e.exe / Compiler / Bin / DINGS_MAIN.h < prev    next >
C/C++ Source or Header  |  2001-03-29  |  7KB  |  253 lines

  1. // Function declaration and implementing for DiNGS
  2. #ifndef _DINGS_MAIN_H
  3. #define _DINGS_MAIN_H
  4.  
  5. #include "Math.h"
  6. #include "stdafx.h"
  7. #include "stdlib.h"
  8. #include "stdio.h"
  9. #include "signal.h"
  10. #include "OpenGLRainbows.h"
  11. #include "OpenGLFont.h"
  12. #include "DirectInput.h"
  13. #include "DXSound.h"
  14.  
  15. #define    CMP_OK                    0x00000
  16. #define    CMP_FOR_WITHOUT_NEXT    0x00001
  17. #define    CMP_SYNTAX_ERROR        0x00002
  18. #define CMP_NO_FILE                0x00003
  19. #define CMP_WRONG_ARGUMENT        0x00004
  20. #define CMP_STRING_TOO_LONG        0x00005
  21. #define CMP_DIVISION_BY_ZERO    0x00006
  22. #define CMP_OUT_OF_MEMORY        0x00007
  23. #define CMP_WRONG_DIMENSION        0x00008
  24. #define CMP_OUT_OF_DIMENSION    0x00009
  25. #define CMP_END_PROGRAM            0x0000A
  26. typedef        int            DGInt;
  27.  
  28. // LIMITATIONS
  29. #define        MAX_STRLEN    1024
  30. #define MAX_WAV_SAMPLES    0x80
  31.  
  32. static LPCTSTR lpszAppName = "DiNGS Game Running";
  33. static HINSTANCE hInstance;
  34.  
  35. // FUNCTIONS
  36. DGInt _Error(DGInt code);
  37. void _EndProgram(void);
  38. void _dLn    (DGInt num);
  39.  
  40. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  41.  
  42. // PROTOTYPE FOR MAIN ENTRY
  43. int    MainGameSub(void);
  44. int    GlobalInit(OpenGLRainbows& rbow, HWND hwnd);
  45.  
  46.  
  47. // ------------------------------------------------------------- //
  48. class DGStr
  49. // ------------------------------------------------------------- //
  50. {
  51. public:
  52.     DGStr();
  53.     DGStr(const char* c);
  54.     DGStr(DGInt i);
  55.     char    GetAt(int i);
  56.     int        SetAt(int i, char c);
  57.     void    Left(int i);
  58.     DGStr& operator=(const char* s);
  59.     DGStr& operator=(const DGInt& i);
  60.     DGStr& operator=(const DGStr& s);
  61.     DGStr& operator+=(const char* s);
  62.     DGStr& operator+=(const DGStr& s);
  63.     DGStr& operator+=(const DGInt& i);
  64.     operator DGInt()                {int i; i=atoi(this->dat); return i;}
  65.     operator const char*()const    {return this->dat;}
  66.     int        Compare            (const DGStr& s);
  67.     int        Compare            (const DGInt& i);
  68.     void    TrimRight(void);
  69. private:
  70.     char dat[MAX_STRLEN];
  71. };
  72.  
  73. // ------------------------------------------------------------- //
  74. class DGIntArray
  75. // ------------------------------------------------------------- //
  76. {
  77. public:
  78.     DGInt*    pData;
  79.     DGInt    fac2;
  80.     DGInt    fac3;
  81.     DGInt    fac4;
  82.     DGInt    fac5;
  83.     DGInt    fac6;
  84.     DGInt    fac7;
  85.     DGInt    fac8;
  86.  
  87.     DGInt    max1;
  88.     DGInt    max2;
  89.     DGInt    max3;
  90.     DGInt    max4;
  91.     DGInt    max5;
  92.     DGInt    max6;
  93.     DGInt    max7;
  94.     DGInt    max8;
  95.     DGInt    dim;
  96.     DGIntArray() {pData=NULL; dim=-1;}
  97.     ~DGIntArray() {if (pData) delete[] pData;}
  98. };
  99.  
  100. // ------------------------------------------------------------- //
  101. class DGStrArray
  102. // ------------------------------------------------------------- //
  103. {
  104. public:
  105.     char*    pData;
  106.     DGInt    fac2;
  107.     DGInt    fac3;
  108.     DGInt    fac4;
  109.     DGInt    fac5;
  110.     DGInt    fac6;
  111.     DGInt    fac7;
  112.     DGInt    fac8;
  113.  
  114.     DGInt    max1;
  115.     DGInt    max2;
  116.     DGInt    max3;
  117.     DGInt    max4;
  118.     DGInt    max5;
  119.     DGInt    max6;
  120.     DGInt    max7;
  121.     DGInt    max8;
  122.     DGInt    dim;
  123.     DGStrArray() {pData=NULL; dim=-1;}
  124.     ~DGStrArray() {if (pData) delete[] pData;}
  125. };
  126.  
  127.  
  128. // ------------------------------------------------------------- //
  129. DGInt PutFile(LPCTSTR filename, short line, DGStr& data);
  130. DGInt GetFile(LPCTSTR filename, short line, DGStr& data);
  131. DGInt    SIN(DGInt angle);
  132. DGInt    COS(DGInt angle);
  133. DGInt    TAN(DGInt angle);
  134. DGInt    KEY(DGInt key);
  135. DGInt    RND(DGInt max);
  136.  
  137. #define SET(a, b) a =b
  138. #define ADD(a, b) a+=b
  139.  
  140. DGInt    SUB(DGInt& n, DGInt a);
  141. DGInt    SUB(DGInt& n, DGStr s);
  142. DGInt    SUB(DGStr& s, DGInt n);
  143. DGInt    SUB(DGStr& s, DGStr a);
  144. DGInt    MUL(DGInt& n, DGInt a);
  145. DGInt    MUL(DGInt& n, DGStr s);
  146. DGInt    MUL(DGStr& s, DGInt n);
  147. DGInt    MUL(DGStr& s, DGStr a);
  148. DGInt    DIV(DGInt& n, DGInt a);
  149. DGInt    DIV(DGInt& n, DGStr s);
  150. DGInt    DIV(DGStr& s, DGInt n);
  151. DGInt    DIV(DGStr& s, DGStr a);
  152.  
  153. DGInt    NOT(DGStr& s, DGInt i);
  154. DGInt    NOT(DGInt& n, DGInt i);
  155. DGInt    OR (DGStr& s, DGInt i);
  156. DGInt    OR (DGInt& n, DGInt i);
  157. DGInt    AND(DGStr& s, DGInt i);
  158. DGInt    AND(DGInt& n, DGInt i);
  159.  
  160. DGInt    ARY(DGIntArray& arr, DGInt dim, DGInt xt1, DGInt xt2=0, DGInt xt3=0, DGInt xt4=0,
  161.                                         DGInt xt5=0, DGInt xt6=0, DGInt xt7=0, DGInt xt8=0);
  162. DGInt    ARY(DGStrArray& arr, DGInt dim, DGInt xt1, DGInt xt2=0, DGInt xt3=0, DGInt xt4=0,
  163.                                         DGInt xt5=0, DGInt xt6=0, DGInt xt7=0, DGInt xt8=0);
  164. DGInt    GETARR(DGInt& rv, DGInt    dim, DGIntArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
  165.                                         DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
  166.                                         DGInt xt7=0, DGInt xt8=0);
  167. DGInt    GETARR(DGStr& rv, DGInt    dim, DGStrArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
  168.                                         DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
  169.                                         DGInt xt7=0, DGInt xt8=0);
  170. DGInt    PUTARR(DGInt rv, DGInt    dim, DGIntArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
  171.                                         DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
  172.                                         DGInt xt7=0, DGInt xt8=0);
  173. DGInt    PUTARR(DGStr& rv, DGInt    dim, DGStrArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
  174.                                         DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
  175.                                         DGInt xt7=0, DGInt xt8=0);
  176. void    NSAME(DGInt& i, DGInt j);
  177. void    NSAME(DGInt& i, DGStr s);
  178. void    NSAME(DGStr& s, DGInt i);
  179. void    NSAME(DGStr& s, DGStr t);
  180. void    SAME(DGInt& i, DGInt j);
  181. void    SAME(DGInt& i, DGStr s);
  182. void    SAME(DGStr& s, DGInt i);
  183. void    SAME(DGStr& s, DGStr t);
  184. void    BIGGER(DGInt& i, DGInt j);
  185. void    BIGGER(DGInt& i, DGStr s);
  186. void    BIGGER(DGStr& s, DGInt i);
  187. void    BIGGER(DGStr& s, DGStr t);
  188. void    BIG_EQ(DGInt& i, DGInt j);
  189. void    BIG_EQ(DGInt& i, DGStr s);
  190. void    BIG_EQ(DGStr& s, DGInt i);
  191. void    BIG_EQ(DGStr& s, DGStr t);
  192. void    SMAL_EQ(DGInt& i, DGInt j);
  193. void    SMAL_EQ(DGInt& i, DGStr s);
  194. void    SMAL_EQ(DGStr& s, DGInt i);
  195. void    SMAL_EQ(DGStr& s, DGStr t);
  196. void    SMALER(DGInt& i, DGInt j);
  197. void    SMALER(DGInt& i, DGStr s);
  198. void    SMALER(DGStr& s, DGInt i);
  199. void    SMALER(DGStr& s, DGStr t);
  200.  
  201. DGInt    END();
  202. DGInt    MIDSTR(DGStr s, DGStr& mid, DGInt start, DGInt len);
  203. DGInt    BLACKSCREEN(void);
  204. DGInt    BLENDSCREEN(DGStr s);
  205. DGInt    PLAYMOVIE(DGStr s);
  206. DGInt    PRINT(DGStr s, DGInt x, DGInt y);
  207. DGInt    PRINT(DGInt i, DGInt x, DGInt y);
  208. DGInt    ROTOSPRITE(DGInt num, DGInt x, DGInt y, DGInt angle, DGInt alpha);
  209. DGInt    ROTOZOOMSPRITE(DGInt num, DGInt x, DGInt y, DGInt angle, DGInt size, DGInt alpha);
  210. DGInt    SHOWSCREEN(void);
  211. DGInt    SPRITE(DGInt num, DGInt x, DGInt y, DGInt alpha);
  212. DGInt    USEASBMP();
  213. DGInt    ZOOMSPRITE(DGInt num, DGInt x, DGInt y, DGInt xsize, DGInt ysize, DGInt alpha);
  214. DGInt    INPUT(DGStr& s, DGInt x, DGInt y);
  215. DGInt    INPUT(DGInt& s, DGInt x, DGInt y);
  216. DGInt    JOYSTATE(DGInt& jx, DGInt& jy, DGInt& b1, DGInt& b2);
  217. DGInt    KEYWAIT(void);
  218. DGInt    MOUSESTATE(DGInt& jx, DGInt& jy, DGInt& b1, DGInt& b2);
  219. DGInt    MOUSEWAIT(void);
  220. DGInt    GETFILE(DGStr file, DGInt line, DGInt& num);
  221. DGInt    GETFILE(DGStr file, DGInt line, DGStr& str);
  222. DGInt    PUTFILE(DGStr file, DGInt line, DGInt num);
  223. DGInt    PUTFILE(DGStr file, DGInt line, DGStr str);
  224. DGInt    LOADBMP(DGStr s);
  225. DGInt    LOADFONT(DGStr s);
  226. DGInt    LOADSPRITE(DGStr s, DGInt n);
  227. DGInt    LOADSOUND(DGStr s, DGInt num, DGInt buffers);
  228. DGInt    PLAYSOUND(DGInt num, DGInt fade);
  229. DGInt    HUSH(void);
  230. DGInt    SAVEBMP(DGStr s);
  231. DGInt    BOXCOLL(DGInt& check, DGInt x1, DGInt y1, DGInt w1, DGInt h1, DGInt x2, DGInt y2, DGInt w2, DGInt h2);
  232. #endif // DEFINE
  233.  
  234.  
  235. // Extern Symbols
  236. extern OpenGLRainbows    rbow;
  237. extern OpenGLFont        fnt;
  238. extern DirectInput        DXin;
  239. extern int                _DG_RESX;
  240. extern int                _DG_RESY;
  241. extern int                _DG_DEBUG;
  242. extern int                _DG_FULLSCREEN;
  243. extern int                _DG_FRAMERATE;
  244. extern int                __HR;
  245. extern DGInt            _g_mx, _g_my;
  246. extern DGInt            _g_debugline;
  247. extern DGInt            _g_error;
  248. extern DGInt            _g_errorline;
  249.  
  250.  
  251.  
  252.  
  253.